-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to easily convert an AndroidAppWaker into a Waker #171
base: main
Are you sure you want to change the base?
Conversation
This commit adds a "waker()" method to AndroidAppWaker. It converts it into an `std::task::Waker`, which is the type of waker used by asynchronous tasks for scheduling. The goal is to allow AndroidAppWaker to be easily used to set up an asynchronous context. The implementation is very efficient, owing to the "static pointer" style of coding already used. The "wake" function just calls ALooper_wake, and cloning/dropping the waker is just a copy. Signed-off-by: John Nunley <[email protected]>
Build failure is due to codebase rot |
Yeah, we're really lacking maintenance here, unfortunately. As always, I'm happy to submit PRs to tackle issues and implement features every once in a while in between other tasks, but need a second maintainer for review and approval. @rib can you update us on your availability and commitment towards this crate, or should we seek for a third maintainer to fill this review-gap? |
Regarding the PR itself, note that the result of a looper wake is very loosely defined and not to be relied on: #170 If there's any explicit |
Interesting. Does it have a chance of spuriously not waking up the event loop? |
@notgull according to their documentation, it would get batched up with other events, such that the event loop is "active" / "awake" but without ever seeing it return
But it also checked these before entering a With these findings, it'll miss events on |
I would prefer to just use eventfd. |
Same preference here, it's much more explicit than pretending every For redraws specifically, there's a preference to handle these via |
This commit adds a "waker()" method to AndroidAppWaker. It converts it
into an
std::task::Waker
, which is the type of waker used byasynchronous tasks for scheduling. The goal is to allow AndroidAppWaker
to be easily used to set up an asynchronous context.
The implementation is very efficient, owing to the "static pointer"
style of coding already used. The "wake" function just calls
ALooper_wake, and cloning/dropping the waker is just a copy.
Discussion questions:
waker()
take&self
orself
? I chose the latter.